libelf: move to init text/data when built for the hypervisor
authorKeir Fraser <keir@xen.org>
Thu, 4 Nov 2010 16:37:29 +0000 (16:37 +0000)
committerKeir Fraser <keir@xen.org>
Thu, 4 Nov 2010 16:37:29 +0000 (16:37 +0000)
Rather than annotating each and every function and data object (and
then still missing some compiler generated ones, plus getting into
ugliness due to the code also being built from tools/libxc/), use
objcopy to rename all relevant sections.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/ia64/xen/xen.lds.S
xen/arch/x86/xen.lds.S
xen/common/libelf/Makefile

index f642a93dc05329debab52c0a5b96b42a51a85356..46e9421743f0ab829d877cc1b635ab70ac24c046 100644 (file)
@@ -120,7 +120,13 @@ SECTIONS
        }
 
   .init.data : AT(ADDR(.init.data) - LOAD_OFFSET)
-       { *(.init.data) }
+       {
+         *(.init.rodata)
+         *(.init.rodata.str*)
+         *(.init.data)
+         *(.init.data.rel)
+         *(.init.data.rel.*)
+       }
 
   .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET)
        {
index 2bc66042ded054e2ed1bdf39a3cbb68ac7f40c3e..1ffd4e98de0603a84e9bd18d08894060350d9a26 100644 (file)
@@ -79,7 +79,11 @@ SECTIONS
        _einittext = .;
   } :text
   .init.data : {
+       *(.init.rodata)
+       *(.init.rodata.str*)
        *(.init.data)
+       *(.init.data.rel)
+       *(.init.data.rel.*)
   } :text
   . = ALIGN(32);
   .init.setup : {
index a586e1ae125fc05a169295c490aa4e70b703dcea..854e73808932ddb44ade838912546a724fc2f08d 100644 (file)
@@ -1,4 +1,9 @@
-obj-y += libelf-tools.o
-obj-y += libelf-loader.o
-obj-y += libelf-dominfo.o
-#obj-y += libelf-relocate.o
+obj-y := libelf.o
+
+SECTIONS := text data rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) $(foreach r,rel rel.ro,data.$(r) data.$(r).local)
+
+libelf.o: libelf-temp.o Makefile
+       $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
+
+libelf-temp.o: libelf-tools.o libelf-loader.o libelf-dominfo.o #libelf-relocate.o
+       $(LD) $(LDFLAGS) -r -o $@ $^